package com.totoro.service.impl;

import com.totoro.mapper.CartMapper;
import com.totoro.pojo.Cart;
import com.totoro.pojo.Product;
import com.totoro.service.CartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author TOTORO
 * @date 2021/7/13 17:59
 */
@Service
public class CartServiceImpl implements CartService {

    @Autowired
    CartMapper cartMapper;

    @Override
    public List<Cart> test(int uid, int findType) {
        return cartMapper.test(uid, findType);
    }

    @Override
    public List<Product> findCartProduct(int uid) {
        return cartMapper.findCartProduct(uid);
    }

    @Override
    public Product findNextCartProductByCartId(int cartId) {
        return cartMapper.findNextCartProductByCartId(cartId);
    }

    @Override
    public List<Integer> findSameCartProductSku(Cart cart) {
        return cartMapper.findSameCartProductSku(cart);
    }

    @Override
    public Cart findOneCartDataByCartId(int cartId) {
        return cartMapper.findOneCartDataByCartId(cartId);
    }

    @Override
    public List<Cart> batchFindCartDataByCartId(Integer[] cartIds) {
        return cartMapper.batchFindCartDataByCartId(cartIds);
    }

    @Override
    public Integer deleteCartRow(int cartId) {
        return cartMapper.deleteCartRow(cartId);
    }

    @Override
    public Integer batchDeleteCartRow(Integer[] cartIds) {
        return cartMapper.batchDeleteCartRow(cartIds);
    }

    @Override
    public Integer updateCartProductAttrByUidAndPid(int count, int skuId, int cartId) {
        return cartMapper.updateCartProductAttrByUidAndPid(count, skuId, cartId);
    }

    @Override
    public Integer addCartProduct(Cart cart) {
        return cartMapper.addCartProduct(cart);
    }

    @Override
    public Integer batchAddCartProduct(List<Cart> carts) {
        return cartMapper.batchAddCartProduct(carts);
    }

    @Override
    public Integer updateCartProductCountByCartId(int count, int cartId) {
        return cartMapper.updateCartProductCountByCartId(count, cartId);
    }

    @Override
    public Integer deleteCartProductBySkuIdAndPidAndUid(int uid, int pid, int skuId) {
        return cartMapper.deleteCartProductBySkuIdAndPidAndUid(uid, pid, skuId);
    }

}
